package com.wmyg.antifake.controller;

import com.wmyg.antifake.utils.IdentifyCreateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: antifake
 * @description: 验证码生成模块
 * @author: wong
 * @create: 18-12-6
 */
@RestController
@RequestMapping("/identify")
public class IdentifyController {

    @Autowired
    RedisTemplate redisTemplate;

    @RequestMapping("/genIdentifyCode")
    public String genIdentifyCode(String  deviceId){
        String code = IdentifyCreateUtil.createIdentify(deviceId);
        redisTemplate.opsForValue().set(deviceId,code);
        System.out.println(redisTemplate.opsForValue().get(deviceId));
        return code;
    }
}
